package com.etcn.common.pojo;

import java.util.Map;

import com.etcn.common.utils.DataUtil;
import com.etcn.common.utils.JsonHandler;

public class VerifySms extends Sms{

	private static final long serialVersionUID = 1L;

	/**
	 * 验证码
	 */
	private String vCode;
	
	/**
	 * 有效期
	 */
	private String validity;
	
	public String getvCode() {
		return vCode;
	}

	public String getValidity() {
		return validity;
	}

	public void setvCode(String vCode) {
		this.vCode = vCode;
	}

	public void setValidity(String validity) {
		this.validity = validity;
	}
	
	public VerifySms(){}
	
	@Override
	public String toString() {
		String jsonStr = null;
		try {
			jsonStr = JsonHandler.buildNoNull().toJson(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return jsonStr;
	}

	@Override
	public Map<String, Object> getParams() {
		Map<String,Object> params =  super.getParams();
		if(vCode == null){
			vCode = DataUtil.createRandomNumCode(6);
		}
		params.put("vCode", vCode);
		if(validity == null){
			validity = "10分钟";
		}
		params.put("validity", validity);
		return params;
	}
	
}
